#include <Length.h>
#include <cmath>

Length::Length(double length, Precision* precision, Checker* checker) :
    length_m(length), precision_m(precision), checker_m(checker)
{
}

Length::operator double() const
{
    return (*precision_m)(length_m);
}

bool
Length::isValid() const
{
    return (*checker_m)((*precision_m)(length_m));
}

bool
Length::change(double length)
{
    if((*checker_m)((*precision_m)(length_m)))
    {
        length_m = length;
    }

    return (*checker_m)((*precision_m)(length_m));
}

